weeknum,daynum = map(int,input().split())
swimdays = 0

sum = 0
for i in range(daynum):
    if (weeknum>7):
        weeknum %= 7
    if (weeknum < 6):
        sum += 250
        swimdays += 1
    weeknum += 1
print(sum)


# # 第一周游泳天
# if (weeknum == 6) :
#     daynum = daynum - 1
# elif (weeknum < 6):
#     if (weeknum + daynum < 5):
#         swimdays = daynum + 1
#     else:
#         swimdays = 6 - weeknum
# # print(swimdays)
#
# # 抛去第一周的日子
# daynum = daynum - (7 - weeknum)-1
# # print(daynum)
#
# weeknums, endday = divmod(daynum,7)
# # print(weeknums, endday)
# if (endday == 6):
#     endday -= 1
# swimdays += 5*weeknums + endday
#
# print(swimdays*250)